/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package com.aurora.renren;

import lombok.extern.slf4j.Slf4j;
import lombok.extern.slf4j.XSlf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;


@EnableDiscoveryClient
@SpringBootApplication
@Slf4j
public class RenrenApplication {

	public static void main(String[] args) throws UnknownHostException {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(RenrenApplication.class, args);
		ConfigurableEnvironment environment = applicationContext.getEnvironment();
		String ip = InetAddress.getLocalHost().getHostAddress();
		String port = environment.getProperty("server.port");
		String path = environment.getProperty("server.servlet.context-path");
		path = path == null?"":path;
		StringBuffer sb = new StringBuffer();
		sb.append("\n-------------------------------------------\n\t");
		sb.append("Applicaiton service is running!\n\t");
		sb.append("Address:http://"+ip+":"+port+"/"+path+"\n\t");
		sb.append("\n-------------------------------------------\n\t");
		log.info(sb.toString());

	}

}